<template>
	<view style='height: 100%;'>
		<navbar title="会议列表" :back="true" color="#fff" leftIconColor="#fff"></navbar>
	    <view class="conten">
			<view style="position: fixed;z-index: 20000;left: 0;width: 100%;background-color:#3277fc;padding-top: 20rpx;" :style="{top:`${rect.bottom+7}px`}">
				<view style="border-radius: 26rpx;margin: 0 20rpx;">
					<u-search placeholder="输入会议关键词"  :showAction='false' v-model='params.keyword' borderColor='#3277fc' height='60' bgColor='#fff' color='#000' searchIcon='search' placeholderColor='##a5a5a5' searchIconColor='#a5a5a5'
						@search="search()">
					</u-search>
				</view>
				<view style="margin-top: 20rpx;">
					 <cc-dropDownMenu arrBase64='https://cdn.yowswl.com/image/admin/2023/11/08/4dbe930e3668490a8e40a0a6f40b109eqle1mpfod0.png' barTextColor='#fff' :titleArr="titleArr" :dropArr="dropArr" @finishDropClick="finishClick" bgcolor='transparent' :date='date' :navType='type' v-if="show"></cc-dropDownMenu>
				</view>
			</view>
			<view style="height: 180rpx;"></view>
			<view style="padding: 20rpx" v-if="shopList.length!=0">
				 <listItem :list="shopList" :params="params"></listItem>
			</view>
			<view v-else style="padding: 20rpx;">
				<u-empty
				        text='暂无会议哦~'
				        mode="list"
				        icon="http://cdn.uviewui.com/uview/empty/list.png"
				>
				</u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	import listItem from "@/components/lsitItem.vue"
	import navbar from '@/components/baseNavbar.vue'
	import {
		getIndexList,
		getChildList
	} from "@/api/make.js"
	export default{
		components:{
			navbar,
			listItem 
		},
		data(){
			return{
				type:'',
				show:false,
				titleArr: ['区域', '类型', '时间', '状态'],
				rect:{},
				date:'',
				params: {
					limit: 10,
					page: 1,
					statue:'',
					city:'',
					district:'',
					beginTime:'',
					cateld:'',
					childCateId:'',
					keyword:'',
					loadTxt:'',
					load: true,
				},
				loading: false,
				loadend: false,
				shopList:[],
				dropArr: [
					// 区域
					[],
					// 户型
					[],
					[],
					// [@"≤1000",@"1000-1500",@"1500-2000",@"2000-3000",@"3000-4000㎡,@"≥4000"]
					// 租金
					[{
						text:'全部',
						value:""
					},{
						text:'预约中',
						value:0
						
					},{
						text:'进行中',
						value:1
					},{
						text:"己结束",
						value:2
					}]
				],
				
			}
		},
		onLoad(option){
			this.dropArr[0] = uni.getStorageSync('address')
			this.params.city = uni.getStorageSync('city')
			getChildList().then(res=>{
				   console.log('list',res);
					let arr =[]
				   res.data.forEach(item=>{
					   let obj ={
						  text:item.label,
						  value:item.value
					   } 
					   arr.push(obj)
				   })
				   this.dropArr[1] =  this.dropArr[1] = [{text:'不限',value:''},...arr]
				   console.log(this.dropArr[1]);
			       this.show = true
			  })
			if(option.id){
				this.type = option.id
				console.log('1111',this.type);
				this.params.childCateId = option.id
				
			}
			if(option.keyword){
				this.params.keyword=option.keyword
			}
			if(option.date){
				this.date = option.date
				this.params.beginTime=option.date
			}
			 this.resetList()
		},
		onReady() {
		   this.rect = uni.getMenuButtonBoundingClientRect();
		
		},
	    methods:{
			finishClick(e){
				console.log(e);
				if(e[0]!=''){
					 if(e[0].id){
						this.params.district=''
					 }else{
						this.params.district = e[0].text.replace('', '')
				   }
								
				}
				if(e[1]!=''){
					 if(e[1].id){
						 this.params.childCateId=''
					 }else{
						 this.params.childCateId = e[1].value
					}	  
				}
				this.params.beginTime = e[2].replace('', '')
				if(e[3]!=''){
					 this.params.statue = e[3].value
				}
				console.log('参数',this.params);
				this.resetList()
			},
			search(){
				this.resetList()
			},
			resetList() {
				this.params.page = 1
				this.shopList=[]
				this.getList()
			},
			getList() {
				if (!this.params.load) {
					return;
				}
				this.params.load = false;
				this.params.loadTxt = '加载中';
				getIndexList(this.params).then(res => {
					this.params.page++
					this.shopList = this.shopList.concat(res.data.list)
					this.params.load = true
					this.params.loadTxt = '已经到底啦~';
				})
			
			},
		}
	}
</script>
<style lang="scss">
	page{
		height: 100%;
		background-color:#f6f6f6;
	}
</style>
<style lang="scss" scoped>
	.conten{
		
		height: 100%;
		padding-top: 20rpx;
	}
</style>